package com.shigu.admin.manager.vo;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 左侧导航
 * Created by bugzy on 2017/5/5 0005.
 */
public class Nav {
    private Long navId;
    private String title;
    private String icon;
    private String href;
    private boolean spread;
    private Set<Nav> children;
    public Long getNavId() {
        return navId;
    }

    public void setNavId(Long navId) {
        this.navId = navId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public boolean isSpread() {
        return spread;
    }

    public void setSpread(boolean spread) {
        this.spread = spread;
    }

    public Set<Nav> getChildren() {
        return children;
    }

    public void setChildren(Set<Nav> children) {
        this.children = children;
    }

    public void addChildren(Nav n){
        if (children == null) {
            children=new LinkedHashSet<>();
        }
        children.add(n);
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Nav nav = (Nav) o;

        return title != null ? title.equals(nav.title) : nav.title == null;
    }

    @Override
    public int hashCode() {
        return title != null ? title.hashCode() : 0;
    }
}
